package com.fsy.dpclass;

import com.fsy.dpclass.service.impl.ASericeImpl;
import com.fsy.dpclass.service.impl.BSericeImpl;

/**
 * Created by Administrator on 2017/6/26.
 */
public enum BaseEnum {
    B("BSerice", BSericeImpl.class),
    A("ASerice", ASericeImpl.class);

    private String beanName;
    private Class classImpl;

    public String getBeanName() {
        return beanName;
    }

    public void setBeanName(String beanName) {
        this.beanName = beanName;
    }

    public Class getClassImpl() {
        return classImpl;
    }

    public void setClassImpl(Class classImpl) {
        this.classImpl = classImpl;
    }

    BaseEnum(String beanName, Class classImpl){
        this.beanName = beanName;
        this.classImpl = classImpl;
    }

    public static Class getClassImpl(String beanName){
        for(BaseEnum baseEnum : BaseEnum.values()){
            if(beanName.equals(baseEnum.getBeanName())){
                return baseEnum.getClassImpl();
            }
        }
        return null;
    }
}
